.TH std::ranges::view_interface::front 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::ranges::view_interface::front \- std::ranges::view_interface::front

.SH Synopsis
   constexpr decltype(auto) front()             \fB(1)\fP \fI(since C++20)\fP
       requires ranges::forward_range<D>;
   constexpr decltype(auto) front() const       \fB(2)\fP \fI(since C++20)\fP
       requires ranges::forward_range<const D>;

   The default implementation of front() member function returns the first element in
   the view of the derived type. Whether the element is returned by value or by
   reference depends on the operator* of the iterator type.

   1) Let derived be static_cast<D&>(*this). Equivalent to return
   *ranges::begin(derived);. The behavior is undefined if empty() is true (i.e. the
   beginning iterator compares equal to the sentinel), even if the iterator obtained in
   the same way is dereferenceable.
   2) Same as \fB(1)\fP, except that derived is static_cast<const D&>(*this).

.SH Parameters

   \fI(none)\fP

.SH Return value

   The first element in the view.

.SH Notes

   In C++20, no type derived from std::ranges::view_interface in the standard library
   provides their own front() member function. Almost all of these types use the
   default implementation.

   A notable exception is std::ranges::basic_istream_view. For it never satisfies
   forward_range, the view cannot use the inherited front().

   The inherited front() member function is available for std::ranges::empty_view, but
   a call to it always results in undefined behavior.

.SH Example

    This section is incomplete
    Reason: no example

.SH See also

   begin
   cbegin         returns an iterator to the beginning of a container or array
   \fI(C++11)\fP        \fI(function template)\fP
   \fI(C++14)\fP
   ranges::begin  returns an iterator to the beginning of a range
   (C++20)        (customization point object)
   ranges::cbegin returns an iterator to the beginning of a read-only range
   (C++20)        (customization point object)

.SH Category:
     * Todo no example
